<ul class="nav nav-tabs">
    <li role="presentation"><a href="javascript:;" onclick="toonepo()">货到付款</a></li>
    <li role="presentation" class="active"><a href="#">款到发货</a></li>
    <li role="presentation"><a href="javascript:;" onclick="tothreepo()">预付款发货</a></li>
</ul>
<table class="table" id="pomainDiv">
    <thead>
    <tr>
        <th>序号</th>
        <th>采购单编号</th>
        <th>创建时间</th>
        <th>供应商名称</th>
        <th>创建用户</th>
        <th>附加费用</th>
        <th>采购商品总价</th>
        <th>采购单总价</th>
        <th>付款方式</th>
        <th>最低预付款金额</th>
        <th>处理状态</th>
        <th colspan="3">操作</th>
    </tr>
    </thead>
    <tbody id="tableBody"></tbody>
</table>
<div>
    <ul id="page">分页</ul>
</div>

<script id="FeeLastTemplate" type="text/html">
    {{each data value index}}
    <tr>
        <td>{{index+1}}</td>
        <td>{{value.poId}}</td>
        <td>{{value.createTime}}</td>
        <td>{{value.venderList[0].name}}</td>
        <td>{{value.scmUserList[0].name}}</td>
        <td>{{value.tipFee}}</td>
        <td>{{value.productTotal}}</td>
        <td>{{value.poTotal}}</td>
        <td>{{value.payType}}</td>
        <td>{{value.prePayFee}}</td>
        <td>{{value.status}}</td>
        <td><input value="了结" type="button"  onclick="settle('{{value.poId}}')"></td>
    </tr>
    {{/each}}
</script>

<script>
    $(function () {
        showPage2({
            payType:"款到发货",
            currentPage: 1,
            pageSize: 5,
            url: '/getAllPomainForSettle',
            templateId: 'FeeLastTemplate',
            contentId: 'tableBody',
            params: {
                id: 1
            }
        })
    })
    function settle(obj) {
        if(confirm("确认了结此单？")){
            Ajax.post(
                "/settlePomain",
                {poId:obj,
                 endUser:sessionStorage.getItem("account")
                },
                function (result) {
                    show('po/pomainSettle2.html')
                    alert(result.msg)
                }
            )
        }else{
            show('po/pomainSettle2.html')
            return false;
        }

    }
</script>
